﻿using ManYan.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace ManYan.Application
{
    public interface IBaseAppService<T> where T : class,new()
    {
        #region 业务代码
        public Res AddEntity(T entity);
        public Res<List<T>> LoadEntityEnumerable(Expression<Func<T, bool>> where, Expression<Func<T, DateTime?>> orderby, string asc, int pageIndex, int pageSize);

        public Res WhereLoadEntity(Expression<Func<T, bool>> where);
        public T WhereLoadEntityT(Expression<Func<T, bool>> where);

        int DelEntity(Expression<Func<T, bool>> where);

        public List<T> LoadEntityAll();

        public int GetEntitiesCount(Expression<Func<T, bool>> where);

        public Res UpdateEntity(T entity);
        #endregion

        #region 消息返回
        public Res SuccessMsg(T entity);
        public Res ErrorMsg(T? entity);

        public Res SuccessMsg(List<T> entity);
        public Res ErrorMsg(List<T>? entity);
        #endregion


    }
}
